#pragma once

#include <d3dx9.h>


class ActionObject;
class PhysicalObject;
class IRaceController;

enum AGENT_STATE
{
   AS_GET_NEXT_GATE,
   AS_MANOVER,
   AS_WAS_GATE_PASSED
};

class AIAgent
{
private:
   IRaceController& m_raceController;
   ActionObject& m_actionObject;
   PhysicalObject& m_physicalObject;

   AGENT_STATE m_currState;
   D3DXVECTOR3 m_gatePassPoint;

   UINT m_lastGateNo;

public:
   AIAgent(IRaceController& raceController,
           ActionObject& actionObject, 
           PhysicalObject& physicalObject);

   void update(float timeElapsed);

   ActionObject& getActionObject() {return m_actionObject;}

private:
   float calculateAngle(const D3DXVECTOR3& vec1, const D3DXVECTOR3& vec2) const;
   
};
